package com.mall.b2c.domain.member;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Column;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mall.b2c.domain.goods.GoodsDomain;
import com.mall.b2c.enums.ConsultType;
import com.mall.common.domain.BaseEntity;

/**
 * 咨询、建议、投诉、纠错
 * 
 * @author lzx
 *
 */
@Entity
@Table(name = "b2c_consult")
public class ConsultDomain extends BaseEntity {

	private static final long serialVersionUID = -7437504147026467723L;

	private String title;// 消息标题
	private String content;// 消息内容
	private String attachFile; // 上传附件
	private String contact; // 联系方式
	private String returnContent;// 回复内容
	private ConsultType type; // 咨询类型 (咨询、建议、投诉、纠错)
	private Boolean deleteStatus;// 删除状态
	private Boolean readStatus;// 阅读状态
	private Boolean returnStatus;// 回复状态
	private String returner; //回复人
	
	@JsonIgnore
	private MemberDomain member;//会员
	@JsonIgnore
	private GoodsDomain goods; //纠错商品
	
	@PrePersist
	public void prePersist(){
		if(deleteStatus == null){
			deleteStatus = false;
		}
		
		if(readStatus == null){
			readStatus = false;
		}
		
		if(returnStatus == null){
			returnStatus = false;
		}
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getAttachFile() {
		return attachFile;
	}

	public void setAttachFile(String attachFile) {
		this.attachFile = attachFile;
	}

	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	@Column(length = 1000)
	public String getReturnContent() {
		return returnContent;
	}

	public void setReturnContent(String returnContent) {
		this.returnContent = returnContent;
	}

	public ConsultType getType() {
		return type;
	}

	public void setType(ConsultType type) {
		this.type = type;
	}

	public Boolean getDeleteStatus() {
		return deleteStatus;
	}

	public void setDeleteStatus(Boolean deleteStatus) {
		this.deleteStatus = deleteStatus;
	}

	public Boolean getReadStatus() {
		return readStatus;
	}

	public void setReadStatus(Boolean readStatus) {
		this.readStatus = readStatus;
	}

	public Boolean getReturnStatus() {
		return returnStatus;
	}

	public void setReturnStatus(Boolean returnStatus) {
		this.returnStatus = returnStatus;
	}

	public String getReturner() {
		return returner;
	}

	public void setReturner(String returner) {
		this.returner = returner;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public MemberDomain getMember() {
		return member;
	}

	public void setMember(MemberDomain member) {
		this.member = member;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public GoodsDomain getGoods() {
		return goods;
	}

	public void setGoods(GoodsDomain goods) {
		this.goods = goods;
	}
	

}
